<script setup>
import { ref } from 'vue';
import axios from 'axios';

const customUploadHandler = (files) => {
  const formData = new FormData();

  // 添加额外参数
  formData.append('param1', 'value1');
  formData.append('param2', 'value2');

  for (let i = 0; i < files.length; i++) {
    formData.append('files[]', files[i]);
  }

  // 设置请求头
  const config = {
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': 'Bearer your_token'
    }
  };

  // 发送 POST 请求
  axios.post('http://your-backend-url/api/upload', formData, config)
    .then(response => {
      // 处理响应
    })
    .catch(error => {
      // 处理错误
    });
};
</script>


<template>
    <FileUpload :customUpload="true" :uploadHandler="customUploadHandler" mode="advanced" multiple></FileUpload>
</template>